package com.weilele.leisure.time.ui.holder

import android.view.View
import com.weilele.leisure.time.databinding.HolderSimpleTextTitleBinding
import com.weilele.mvvm.adapter.MvvmHolder
import com.weilele.mvvm.adapter.mvvmRcvAdapter
import com.weilele.mvvm.utils.activity.setIcon
import com.weilele.mvvm.utils.activity.textFrom


class SimpleTextTitleHolder : MvvmHolder<SimpleTextTitleHolder.Bean, HolderSimpleTextTitleBinding> {
    companion object {
        fun toAdapter() = mvvmRcvAdapter(SimpleTextTitleHolder::class.java,
            { old, new -> old == new },
            { old, new -> old == new }
        )
    }

    constructor(binding: HolderSimpleTextTitleBinding) : super(binding)
    constructor(itemView: View) : super(itemView)

    data class Bean(
        var title: String?,
        var hint: String?,
        var hintCoin: Int?,
    )

    override fun bindData(data: Bean) {
        mBinding.tvTitle.textFrom(data.title)
        mBinding.tvHint.textFrom(data.hint)
        mBinding.tvHint.setIcon(data.hintCoin)
    }
}